package com.sky.sky_server.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.sky.sky_pojo.entity.SetmealDish;

@Mapper
public interface SetmealDishMapper {
    /**
     * 根据菜品id，查询在套餐菜品表出现的次数
     */
    @Select("select count(*) from setmeal_dish where dish_id = #{dishId}")
    int countByDishId(Long dishId);


    /**
     * 根据菜品id，查询在套餐菜品表出现的次数
     */
    Long selectByDishIds(List<Long> ids);


    /**
     * 批量插入套餐菜品
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);


    /**
     * 根据套餐id，删除套餐菜品
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);


    /**
     * 根据套餐id，查询套餐菜品
     * @param id
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{id}")
    List<SetmealDish> selectBySetmealId(Long id);


    /**
     * 根据套餐id，删除套餐菜品,批量
     * @param ids
     * @return
     */
    int deleteBySetmealIds(List<Long> ids);
}
